# Maintainer: Peter Budai <peterbudai at hotmail dot com>

_realname=osm-gps-map
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.2.0
pkgrel=2
pkgdesc="A Gtk+ Widget for Displaying OpenStreetMap tiles. (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
url="https://nzjrs.github.io/osm-gps-map/"
license=("GPLv2+")
depends=(
    "${MINGW_PACKAGE_PREFIX}-libsoup"
    "${MINGW_PACKAGE_PREFIX}-gtk3"
    "${MINGW_PACKAGE_PREFIX}-gobject-introspection"
)
makedepends=(
    "${MINGW_PACKAGE_PREFIX}-cc"
    "${MINGW_PACKAGE_PREFIX}-autotools"
    "${MINGW_PACKAGE_PREFIX}-gnome-common"
    "${MINGW_PACKAGE_PREFIX}-gtk-doc"
)

source=( https://github.com/nzjrs/osm-gps-map/releases/download/${pkgver}/${_realname}-${pkgver}.tar.gz) 
sha256sums=('ddec11449f37b5dffb4bca134d024623897c6140af1f9981a8acc512dbf6a7a5')

prepare() {
    cd "${srcdir}/${_realname}-${pkgver}"
    # autoreconf to get updated libtool files for clang
    autoreconf -fiv
}

build() {
    [[ -d ${srcdir}/build-${MSYSTEM} ]] && rm -rf ${srcdir}/build-${MSYSTEM}
    mkdir -p ${srcdir}/build-${MSYSTEM} && cd ${srcdir}/build-${MSYSTEM}

    CFLAGS+=" -DG_DISABLE_ASSERT"
    ../${_realname}-${pkgver}/configure \
        --prefix="${MINGW_PREFIX}"      \
        --build=${MINGW_CHOST}          \
        --host=${MINGW_CHOST}           \
        --enable-gtk-doc=no

  make
}

package() {
  cd "${srcdir}/build-${MSYSTEM}"
  make DESTDIR=${pkgdir} install
}
